package com.bwie.controller;

import com.bwie.pojo.User;
import com.bwie.result.Result;
import com.bwie.service.UserService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/user")
@Log4j2
public class UserController {
    @Autowired
    private UserService userService;

    @Autowired
    private HttpServletRequest request;

    @GetMapping("/findByUsername{username}")
    public Result<User> findByUsername(@PathVariable("username") String username){
        User user=userService.findByUsername(username);
        Result<User> result = Result.success(user);
        return result;
    }

}
